/**
 * @author 13771
 * @date 2021/2/23 11:36
 * @description 通过hash表判断数组中的所有元素是否只出现一次
 */
public class work1 {
    public static boolean isUnique(int[] a){

        boolean[] map = new boolean[256];
        for (int i = 0; i < a.length ; i++) {
            if (map[a[i]]){
                return false;
            }
            map[a[i]] = true;
        }
        return true;
    }

    public static void main(String[] args) {
        int[] a = {1,2,1};
        int[] b = {1,2,3};
        int[] c = {1,2,3,4,5,6,7,8,9,100};
        System.out.println(isUnique(a));
        System.out.println(isUnique(b));
        System.out.println(isUnique(c));
    }
}
